| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

Public Member Functions | List of all members
nkWinUi::ComponentUtils Class Referenceabstract

Offers many utilities to deal with the components, specialized for its windowing system. More...

## Public Member Functions
| ComponentUtils () noexcept
virtual | ~ComponentUtils ()
virtual nkMaths::Rectangle | getComponentSize (const Component *component)=0
virtual nkMaths::Rectangle | getScreenDimensions ()=0
virtual nkMaths::Point | getComponentCoordFromScreenCoord (const Component *component, nkMaths::Point screenCoord)=0
virtual nkMaths::Point | getScreenCoordFromComponentCoord (const Component *component, nkMaths::Point componentCoord)=0
virtual nkMaths::Rectangle | getComponentDimensions (const Component *component)=0
virtual void | setComponentPosition (Component *component, float x, float y)=0
virtual void | setComponentSize (Component *component, float width, float height)=0
virtual void | setComponentDimensions (Component *component, float x, float y, float width, float height)=0
virtual bool | getComponentVisibility (const Component *component)=0
virtual void | setComponentVisibility (Component *component, bool visibleOrNot)=0
virtual bool | isComponentEnabled (const Component *component)=0
virtual void | setComponentEnabled (Component *component, bool enabledOrNot)=0
virtual void | setComponentFocus (Component *component)=0
virtual bool | isComponentInForeground (const Component *component)=0
virtual void | setComponentInForeground (Component *component)=0
virtual void | setComponentLabel (Component *component, nkMemory::StringView label)=0
virtual void | updateComponent (Component *component)=0
virtual void | freezeComponentPainting (Component *component, bool value)=0
virtual nkImages::Image | paintToImage (Component *component, bool withFrame)=0
virtual nkMaths::Point | getCursorPosition ()=0
virtual void | setCursorPosition (nkMaths::Point absPos)=0
virtual nkMemory::BufferCast< nkMemory::String > | getAvailableFontFaces ()=0
virtual nkMemory::BufferCast< unsigned int > | getCharactersWidth (nkMemory::BufferView< char > characters, Font *font)=0

## Detailed Description

Offers many utilities to deal with the components, specialized for its windowing system.

## Constructor & Destructor Documentation

## ◆ ComponentUtils()

nkWinUi::ComponentUtils::ComponentUtils | ( |  | ) |
| noexcept

Constructor.

Remarks
  The object's lifetime is managed by its parent windowing system.

## ◆ ~ComponentUtils()

virtual nkWinUi::ComponentUtils::~ComponentUtils | ( |  | ) |
| virtual

Destructor.

Remarks
  The object's lifetime is managed by its parent windowing system.

## Member Function Documentation

## ◆ getComponentSize()

virtual nkMaths::Rectangle nkWinUi::ComponentUtils::getComponentSize | ( | const Component * | component | ) |
| pure virtual

Parameters

  component | The component to check for.

Returns
  The component's size, in pixels.

Remarks
  This method is used internally. For client code, it is usually easier to call Component::getWidth() or Component::getHeight().

## ◆ getScreenDimensions()

virtual nkMaths::Rectangle nkWinUi::ComponentUtils::getScreenDimensions | ( |  | ) |
| pure virtual

Returns
  The screen dimensions, in pixels.

## ◆ getComponentCoordFromScreenCoord()

virtual nkMaths::Point nkWinUi::ComponentUtils::getComponentCoordFromScreenCoord | ( | const Component * | component,
|  | nkMaths::Point | screenCoord
| ) |  |
| pure virtual

Converts component relative coordinates to absolute coordinates on screen.

Parameters

  component | The component to work with.
  screenCoord | The absolute coordinates to convert, in pixels.

Returns
  The converted coordinates, in pixels, relative to the component.

Remarks
  This method is used internally. For client code, it is usually easier to call Component::getCoordAbsoluteFromRelative().

## ◆ getScreenCoordFromComponentCoord()

virtual nkMaths::Point nkWinUi::ComponentUtils::getScreenCoordFromComponentCoord | ( | const Component * | component,
|  | nkMaths::Point | componentCoord
| ) |  |
| pure virtual

Converts absolute screen coordinates to relative coordinates within a component.

Parameters

  component | The component to work with.
  componentCoord | The absolute coordinates to convert, in pixels.

Returns
  The converted coordinates, in pixels, relative to the component.

Remarks
  This method is used internally. For client code, it is usually easier to call Component::getCoordAbsoluteFromRelative().

## ◆ getComponentDimensions()

virtual nkMaths::Rectangle nkWinUi::ComponentUtils::getComponentDimensions | ( | const Component * | component | ) |
| pure virtual

Parameters

  component | The component to check for.

Returns
  The dimensions, in pixels, of the component, absolute on screen.

Remarks
  This method is used internally. For client code, it is usually easier to call Component::getWidth() and Component::getHeight().

## ◆ setComponentPosition()

virtual void nkWinUi::ComponentUtils::setComponentPosition | ( | Component * | component,
|  | float | x,
|  | float | y
| ) |  |
| pure virtual

Sets the position of the component.

Parameters

  component | The component to work on.
  x | The x coordinate, in pixels, within the parent component.
  y | The y coordinate, in pixels, within the parent component.

Remarks
  This method is used internally. For client code, it is usually easier to call Component::setPositionInParent() or Component::setPositionInScreen().

## ◆ setComponentSize()

virtual void nkWinUi::ComponentUtils::setComponentSize | ( | Component * | component,
|  | float | width,
|  | float | height
| ) |  |
| pure virtual

Sets a component's size.

Parameters

  component | The component to work on.
  width | The width in pixels.
  height | The height in pixels.

Remarks
  This method is used internally. For client code, it is usually easier to call Component::setSize().

## ◆ setComponentDimensions()

virtual void nkWinUi::ComponentUtils::setComponentDimensions | ( | Component * | component,
|  | float | x,
|  | float | y,
|  | float | width,
|  | float | height
| ) |  |
| pure virtual

Sets a component's dimensions.

Parameters

  component | The component to work on.
  x | The x position, in pixels, within its parent.
  y | The y position, in pixels, within its parent.
  width | The width in pixels.
  height | The height in pixels.

Remarks
  This method is used internally. For client code, it is usually easier to call Component::setAreaInParent() or Component::setAreaInScreen().

## ◆ getComponentVisibility()

virtual bool nkWinUi::ComponentUtils::getComponentVisibility | ( | const Component * | component | ) |
| pure virtual

Parameters

  component | The component to check.

Returns
  Whether the component is visible (true) or not (false).

Remarks
  This method is used internally. For client code, it is usually easier to call Component::getVisibility().

## ◆ setComponentVisibility()

virtual void nkWinUi::ComponentUtils::setComponentVisibility | ( | Component * | component,
|  | bool | visibleOrNot
| ) |  |
| pure virtual

Sets a component's visibility status.

Parameters

  component | The component to work on.
  visibleOrNot | Whether the component should be visible (true) or not (false).

Remarks
  This method is used internally. For client code, it is usually easier to call Component::setVisibility().

## ◆ isComponentEnabled()

virtual bool nkWinUi::ComponentUtils::isComponentEnabled | ( | const Component * | component | ) |
| pure virtual

Parameters

  component | The component to check.

Returns
  Whether the component is enabled (true) or not (false).

Remarks
  This method is used internally. For client code, it is usually easier to call Component::isEnabled().

## ◆ setComponentEnabled()

virtual void nkWinUi::ComponentUtils::setComponentEnabled | ( | Component * | component,
|  | bool | enabledOrNot
| ) |  |
| pure virtual

Allows to enable or disable a component.

Parameters

  component | The component to work on.
  enabledOrNot | Whether the component should be enabled (true) or not (false).

Remarks
  This method is used internally. For client code, it is usually easier to call Component::setEnabled().

## ◆ setComponentFocus()

virtual void nkWinUi::ComponentUtils::setComponentFocus | ( | Component * | component | ) |
| pure virtual

Sets the focus to a component.

Parameters

  component | The component to set the focus to.

Remarks
  This method is used internally. For client code, it is usually easier to call Component::focusWindow().

## ◆ isComponentInForeground()

virtual bool nkWinUi::ComponentUtils::isComponentInForeground | ( | const Component * | component | ) |
| pure virtual

Parameters

  component | The component to check for.

Returns
  Whether the component is in the foreground (true) or not (false).

Remarks
  This method is used internally. For client code, it is usually easier to call Component::isForegroundWindow().

## ◆ setComponentInForeground()

virtual void nkWinUi::ComponentUtils::setComponentInForeground | ( | Component * | component | ) |
| pure virtual

Sets a component to the foreground.

Parameters

  component | The component to bring to the foreground.

Remarks
  This method is used internally. For client code, it is usually easier to call Component::bringToForeground().

## ◆ setComponentLabel()

virtual void nkWinUi::ComponentUtils::setComponentLabel | ( | Component * | component,
|  | nkMemory::StringView | label
| ) |  |
| pure virtual

Sets a component's label.

Parameters

  component | The target component.
  label | The label to set.

Remarks
  This method is used internally. For client code, it is usually easier to call Component::setLabel().

## ◆ updateComponent()

virtual void nkWinUi::ComponentUtils::updateComponent | ( | Component * | component | ) |
| pure virtual

Forces the update of a component.

Parameters

  component | The component to update.

Remarks
  This method is used internally. For client code, it is usually easier to call Component::updateWindow().

## ◆ freezeComponentPainting()

virtual void nkWinUi::ComponentUtils::freezeComponentPainting | ( | Component * | component,
|  | bool | value
| ) |  |
| pure virtual

Prevents a component from being painted or updated.

Parameters

  component | The component to freeze.
  value | Whether to freeze it (true) or not (false).

Remarks
  Depending on the windowing system, only one component can be frozen at a time.

## ◆ paintToImage()

virtual nkImages::Image nkWinUi::ComponentUtils::paintToImage | ( | Component * | component,
|  | bool | withFrame
| ) |  |
| pure virtual

Allows to paint a component into an image.

Parameters

  component | The component to paint.
  withFrame | Whether the component's frame should also be painted (true) or not (false).

Returns
  The image the component has been painted in.

Remarks
  This method is used internally. For client code, it is usually easier to call Component::paintToImage().

## ◆ getCursorPosition()

virtual nkMaths::Point nkWinUi::ComponentUtils::getCursorPosition | ( |  | ) |
| pure virtual

Returns
  The current cursor absolute position on screen, in pixels.

## ◆ setCursorPosition()

virtual void nkWinUi::ComponentUtils::setCursorPosition | ( | nkMaths::Point | absPos | ) |
| pure virtual

Sets the cursor position, on screen.

Parameters

  absPos | The absolute position, in pixels, the cursor should move to.

## ◆ getAvailableFontFaces()

virtual nkMemory::BufferCast<nkMemory::String> nkWinUi::ComponentUtils::getAvailableFontFaces | ( |  | ) |
| pure virtual

Abstraction of the font face retrieval method. For more information, see FontUtils::getAvailableFontFaces().

Returns
  The available font faces on the system created.

## ◆ getCharactersWidth()

virtual nkMemory::BufferCast<unsigned int> nkWinUi::ComponentUtils::getCharactersWidth | ( | nkMemory::BufferView< char > | characters,
|  | Font * | font
| ) |  |
| pure virtual

Abstraction of the character width method. For more information, see FontUtils::getCharactersWidth().

Parameters

  characters | An array of the characters to retrieve the width from.
  font | The font to use for width retrieval. If left to nullptr, will use the default font.

Returns
  An array of pixel width, each index corresponding to their character's index in the input array.

The documentation for this class was generated from the following file:

- Documentation/Headers/NilkinsWinUi/WindowingSystems/ComponentUtils.h